home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Network Time Protocol Demonstration"
- ClientHeight = 3825
- ClientLeft = 1560
- ClientTop = 1485
- ClientWidth = 7590
- Height = 4230
- Left = 1500
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3825
- ScaleWidth = 7590
- Top = 1140
- Width = 7710
- Begin VB.CommandButton Command2
- Caption = "Command2"
- Height = 375
- Left = 2640
- TabIndex = 7
- Top = 3240
- Width = 4575
- End
- Begin VB.Timer Timer1
- Interval = 1000
- Left = 1320
- Top = 2520
- End
- Begin VB.TextBox Text4
- BeginProperty Font
- name = "Arial"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 2640
- TabIndex = 2
- TabStop = 0 'False
- Top = 1800
- Width = 4575
- End
- Begin VB.CommandButton Command1
- Caption = "Get Time"
- Height = 495
- Left = 2640
- TabIndex = 3
- Top = 2640
- Width = 4575
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- name = "Arial"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 2640
- TabIndex = 0
- Top = 360
- Width = 4575
- End
- Begin GethostLibCtl.GetAdrs GetAdrs1
- Left = 120
- Top = 2520
- _Version = 262144
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin TimeLibCtl.Time Time1
- Left = 720
- Top = 2520
- _Version = 262144
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin VB.Label Label3
- Alignment = 2 'Center
- BeginProperty Font
- name = "Courier New"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 240
- TabIndex = 8
- Top = 3240
- Width = 2055
- End
- Begin VB.Label Label5
- BorderStyle = 1 'Fixed Single
- BeginProperty Font
- name = "Arial"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 2640
- TabIndex = 6
- Top = 1080
- Width = 4575
- End
- Begin VB.Label Label4
- Alignment = 1 'Right Justify
- Caption = "TIME"
- BeginProperty Font
- name = "Arial"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 240
- TabIndex = 5
- Top = 1920
- Width = 2055
- End
- Begin VB.Label Label2
- Alignment = 1 'Right Justify
- Caption = "HOST ADDRESS"
- BeginProperty Font
- name = "Arial"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 240
- TabIndex = 4
- Top = 1200
- Width = 2055
- End
- Begin VB.Label Label1
- Alignment = 1 'Right Justify
- Caption = "TIME HOST NAME"
- BeginProperty Font
- name = "Arial"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 240
- TabIndex = 1
- Top = 480
- Width = 2055
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Const CONNECTING = 1
- Const SENDING_REQUEST = 2
- Const WAITING_FOR_RESPONSE = 3
- Const RECEIVING_INFORMATION = 4
- Const WAITING_FOR_ACTION = 5
- Sub DispErrMsg(errorvalue As Long)
- MsgBox Str(errorvalue)
- End Sub
- Private Sub Command1_Click()
- GetAdrs1.HostName = Text1.Text
- End Sub
- Private Sub Command2_Click()
- If Timer1.Enabled = True Then
- Timer1.Enabled = False
- Command2.Caption = "Enable Timer"
- Else
- Timer1.Enabled = True
- Command2.Caption = "Disable Timer"
- End If
- End Sub
- Private Sub Form_Load()
- Command2.Caption = "Enable Timer"
- Timer1.Enabled = False
- End Sub
- Private Sub GetAdrs1_EndGetHostAddress(ByVal IPAddress As String, ByVal ErrorNumber As Integer)
- Time1.HostAddress = IPAddress
- 'Or the operation can be sequential
- 'MsgBox Time1.GetTime(IPAddress)
- Label5.Caption = IPAddress + " / " + Str(ErrorNumber)
- End Sub
- Private Sub Time1_EndGetTime(ByVal GMTTime As String, ByVal ErrorNum As Integer)
- Text4.Text = GMTTime + " / " + Str(ErrorNumber)
- End Sub
- Private Sub Timer1_Timer()
- Command1_Click
- Select Case Time1.CurrentState
- Case CONNECTING: label3.Caption = "Connecting"
- Case SENDING_REQUEST: label3.Caption = "Requesting"
- Case WAITING_FOR_RESPONSE: label3.Caption = "Waiting"
- Case RECEIVING_INFORMATION: label3.Caption = "Receiving"
- Case WAITING_FOR_ACTION: label3.Caption = "No Operation"
- End Select
- End Sub
-